<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script>
  quicksort = function(arr) {
  if(arr.length <= 1) {return arr;}
  var less = [];
  var greater = [];
  var pivoIndex = Math.floor(arr.length/2);
  var prvot = arr.splice(pivoIndex, 1);
  for(var i = 0, len = arr.length; i < len; i++) {
    if(arr[i]<pivot) {
      less.push(arr[i]);
    } else {
      greater.push(arr[i]);
    }
  }
  return quicksort(less).concat([pivot], quicksort(greater));
}

var arr = [89,28,743,18,93,58,84,65];
console.log("数组元素的原始排列：" + arr.join(","));
console.log("排序后，数组元素的排列：" + quickSort(arr).join(","));
</script>
</head>
<body>
    
</body>
</html>